using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
using RCS.Config;
using Seer.SeerSocket;


[ApiController]
[Route("[controller]/[action]")]
public class SeerController : ControllerBase
{


	private readonly IConfiguration configuration;

	public SeerController(IConfiguration configuration)
	{
		this.configuration = configuration;
	}


	[HttpGet]
	public string Now()
	{
		return DateTime.Now.ToString();
	}


	[HttpGet]
	public string AgvInfo(string ip)
	{
		// 将内容写入本地json文件
		var configurationSection = this.configuration.GetSection("CacheJson");
		var options = new AgvCacheJsonOptions();
		configurationSection.Bind(options);

        string jsonPath = Path.Combine(options.AgvJsonFolder!, ip+".json");
		// 读取文件中的所有文本
		string jsonString = System.IO.File.ReadAllText(jsonPath);

		return jsonString;

	}

}





